/* Teach Tool  - Structural Dynamics
 * Copyright (C) 2009: Fabian Gerold, www.fabiangerold.de
 *
 * This file may be licensed under the terms of of the
 * GNU General Public License Version 3 (the "GPL").
 * 
 * Software distributed under the License is distributed 
 * on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
 * express or implied. See the GPL for the specific language 
 * governing rights and limitations.
 *
 * You should have received a copy of the GPL along with this 
 * program. If not, go to http://www.gnu.org/licenses/gpl.html
 * or write to the Free Software Foundation, Inc., 
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

#ifndef ISD_DIAGRAMSCROLL_H
#define ISD_DIAGRAMSCROLL_H 1

#include <QtGui>
class Diagram;
class System;

class DiagramScroll : public QScrollArea
{
	Q_OBJECT
public:
	DiagramScroll( System* sys, QWidget *parent = 0 );
	Diagram* getDiag() { return m_diag; }
	QSize sizeHint() const;
	QSize minimumSizeHint() const;
	void srollToZero();
	void moveDiag( int diff );

protected:
	void wheelEvent( QWheelEvent* event );
	void mousePressEvent(QMouseEvent  *event);
	void mouseReleaseEvent(QMouseEvent  *event);
	void mouseMoveEvent ( QMouseEvent  * event );
	void resizeEvent( QResizeEvent * event );

public slots:
	void slotMove();

private:
	Diagram*	m_diag;
	int			m_lastpos;
	int			m_xpos;
	QTimer		m_timer;
	QTime 		m_time;
	double		m_t_last;
	double		m_v0;
};

#endif
